
import { defineStore } from 'pinia';

export const checkoutInfo = defineStore('checkout', {
  state: () => ({
    address: {}, // 购物车下单地址
	invoice: {}, // 下单发票信息
	
	goods_sku_id : 0, // 立即购买获取当前商品地址的ID
  }),
  actions: {
	// 存储购物车下单地址
    setAddress(data) {
      this.address = data;
    },
	
	// 存储下单发票
	setInvoice(data) {
	  this.invoice = data;
	},
	
	setSkuId(id){
		this.goods_sku_id = id;
	},
	
	clearState(){
		this.address = {};
		this.invoice = {};
		this.goods_sku_id = 0;
	}
  },
});